<template>
  <swiper ref="swiper">
    <swiper-item class="item" v-for="(item, index) in banners" :key="index">
        <img :src="item" alt="" @load="imageLoad">
    </swiper-item>
  </swiper>
</template>

<script>
  import Swiper from '@/components/common/swipper/Swiper'
  import SwiperItem from '@/components/common/swipper/SwiperItem'
export default {
  name: 'IshopDetailswiper',
  components:{
    Swiper,
    SwiperItem,
  },
  props: {
    banners:{
      type: Array,
      default: []
    } 
  },
  watch:{
    banners: function (newValue) {
      this.$nextTick(function () {
        this.$refs.swiper.domUpdateForData()
      });
      this.isLoad = false
    }
  },
  data() {
    return {
      isLoad: false
    };
  },

  mounted() {
    
  },

  methods: {
    imageLoad:function(){
      if(!this.isLoad){
        this.isLoad = true
        this.$emit('swiperImageLoad');
      }
    }
  },
};
</script>

<style scoped>
  .item {
    text-align: center;
    height: 300px;
  }
</style>